<!DOCTYPE html>
<extend name="Base:base"/>
<block name="title"><title>欢迎注册</title>
<import type='css' file='Css.logreg'/>
<import type='js' file='Js.register'/> 
<import type='js' file='Js.jquery'/> 
<script type="text/javascript">
//用户信息填写规范才能提交表单
function proof(){
    var t1=document.getElementById("tip1").innerHTML;
    var t2=document.getElementById("tip2").innerHTML;
    var t3=document.getElementById("tip3").innerHTML;
    var username=document.getElementById("username").value;
    var password=document.getElementById("password").value;
    var identify=document.getElementById("identify").value;
    if(username!=""&&password!=""&&identify!=""){
        $.ajax({
            url: "{:U('/Home/User/reg')}",
            type: 'POST',
            dataType: 'json',
            data: {
                username: username,
                password: password,
                identify: identify
            }
        })
        .done(function(data) {
            console.log(data);
            if(data.code == 200){
                location.href = "{:U('/Home/User/login')}";
            }
            alert(data.msg);
        })
        .fail(function() {
            console.log("error");
        })
        .always(function() {
            console.log("complete");
        });
    } else {
        alert('信息不全');
    }
}
</script>
</block>
<block name="content">
<div class="register-main"style="background: url(__PUBLIC__/img/login.png)">
    <div class="register-mainBox">
        <div class="clearFiy">
        </div>
        <div class="show">
            <img src="__PUBLIC__/img/loginshow.png">
            <div class="explain">
                “指间岁月 淡淡的怀念”<br/>
                摄于：天津大学<br/>
                by  李方方<br/>
            </div>
        </div>
		<!--form提交action  js判断了正确手机号以及密码并且错误不能提交-->
        <form action="completeInf.html" method="post" id="registerForm" name="registerForm">
            <div class="register-form " >
                <div class="usernameBox focus">
                    <input id="username" class="username" type="text" value="" tabindex="1" curr_val="4">
                    <label class="placeholder1" for="username" style="">
                       输入正确的手机号
                    </label>
                    <p id="tip1"></p>
                </div>
                <div class="passwordBox focus">
                    <input id="password" class="password"  type="password"tabindex="2">
                    <label class="placeholder2" for="password">
                       输入至少6位密码
                    </label>
                    <p id="tip2"></p>
                </div>
                <div class="identifyBox focus">
                    <input id="identify" class="identify" type="text" tabindex="3">
                    <label class="placeholder3" for="identify">
                        输入验证码
                    </label>
                    <p id="tip3"></p>
                    <a class="yzm">获取验证码</a>
                </div>
                <div class="registerBottom">
                    <a href="javascript:"class="registerBtn" tabindex="3" onclick="proof()">注册</a>
                </div>
            </div>
        </form>
    </div>
</div>
</block>
